#include <iostream>
using namespace std;

int main() {
	long long N;
	cin >> N;
	long long result;
	if (N<=2) {
		result = N;
	} else if (N%2) {
		result = N*(N-1)*(N-2);
	} else {
		if (N%3)
			result = N*(N-1)*(N-3);
		else
			result = (N-1)*(N-2)*(N-3);
	}
	cout << result << endl;
	
	return 0;
}
